package com.xxadmin.common.vo;


import com.xxadmin.common.constant.ResponseCommonEnum;
import com.xxadmin.common.constant.ResponseEnum;
import com.xxadmin.common.vo.ResponseModel;

/**
 * 创建 ResponseModel
 *
 * @author:chenming
 * @date:2018/8/22
 */
public class ResponseModelBuilder<T> {

    public static ResponseModel genericResponseModal(){
        return new ResponseModel();
    }

    public static <T> ResponseModel<T> genericResponseModal(ResponseEnum responseEnum){
        ResponseModel<T> responseModel = new ResponseModel(responseEnum);

        return responseModel;
    }

    public static <T> ResponseModel<T> genericSuccessResponseModal(){
        ResponseModel<T> responseModel = new ResponseModel(ResponseCommonEnum.SUCCESS);

        return responseModel;
    }

    public static <T> ResponseModel<T> genericSuccessResponseModal(T data){
        ResponseModel<T> responseModel = new ResponseModel(ResponseCommonEnum.SUCCESS);
        responseModel.setData(data);

        return responseModel;
    }

    public static <T> ResponseModel<T> genericErrorResponseModal(String errorCode,String errorMessage){
        ResponseModel responseModel = new ResponseModel();
        responseModel.setMessage(errorMessage);
        responseModel.setCode(errorCode);

        return responseModel;
    }

    public static <T> ResponseModel<T> genericErrorResponseModal(){
        ResponseModel responseModel = new ResponseModel();

        return responseModel;
    }
}
